For normal indexing, if the resulting index is outside the list, Python raises an IndexError exception. ... if value in L: print "list contains", value To get the index of the first matching item, use index: i = L.index(value) The index method d